package io.renren.modules.sp.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.constant.Constant;
import io.renren.modules.sp.dao.SpExcludeAreaDao;
import io.renren.modules.sp.dto.SpExcludeAreaDTO;
import io.renren.modules.sp.entity.SpExcludeAreaEntity;
import io.renren.modules.sp.service.SpExcludeAreaService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 排除报名地区
 *
 * @author whc sunlightcs@gmail.com
 * @since 3.0 2024-05-30
 */
@Service
public class SpExcludeAreaServiceImpl extends CrudServiceImpl<SpExcludeAreaDao, SpExcludeAreaEntity, SpExcludeAreaDTO> implements SpExcludeAreaService {

    @Override
    public QueryWrapper<SpExcludeAreaEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<SpExcludeAreaEntity> wrapper = new QueryWrapper<>();

        Long matchId = (Long)params.get("matchId");
        if(matchId != null){
            wrapper.eq("match_id", matchId);
        }
        String city = (String)params.get("city");
        if(StringUtils.isNotBlank(city)){
            wrapper.eq("city", city);
        }
        return wrapper;
    }


}